﻿using JoJoC_AOP.AOPS;
using JoJoC_AOP.Models;

namespace JoJoC_AOP.Services
{
    public class ProductService : IProductService
    {
        // 如果要将数据保存在缓存当中 定义一个字典
        private static Dictionary<string, List<Product>> _products = new Dictionary<string, List<Product>>();

        [MyServiceAop]
        [ProductAop]
        public List<Product> GetProduct()
        {
            // 商品数据来自于数据库  当前为测试数据
            List<Product> Products = new List<Product>();

            Products.Add(new Product() { 
                Id = "1",
                ProductName = "手机",
            });

            Products.Add(new Product()
            {
                Id = "2",
                ProductName = "风扇",
            });
            // 将数据保存在缓存当中
            //_products.Add("Products", Products);
            return Products;
        }
    }
}
